package org.windey.server;

import java.io.IOException;
import java.util.Properties;
/**
 * 
 * 
 *
 */
public class WindeyServerFileSettings extends WindeyServerSettings
{
	/**
	 * 
	 */
	private Properties configFile;
	
	/**
	 * 
	 * @throws InvalidPropertyFileException
	 */
	public WindeyServerFileSettings() throws InvalidPropertyFileException
	{
		configFile = new Properties();
		try {
			configFile.load(this.getClass().getResourceAsStream("server.properties"));
		} catch (IOException e) {
			throw new InvalidPropertyFileException();
		} 
	}

	/**
	 * @return
	 */
	public int getClientConnectPort()
	{
		return Integer.parseInt(configFile.getProperty("ClientConnectPort"));
	}

	/**
	 * @param port
	 */
	public void setAppletConnectPort(int port)
	{
		configFile.setProperty("AppletConnectPort", Integer.toString(port));
	}

	/**
	 * @param port
	 */
	public void setClientConnectPort(int port)
	{
		configFile.setProperty("ClientConnectPort", Integer.toString(port));		
	}

	/**
	 * @return
	 */
	public int getAppletConnectPort()
	{
		return Integer.parseInt(configFile.getProperty("AppletConnectPort"));

	}

}
